/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.ibrae.mchs.radiation.entities;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "result")
@NamedQueries({
    @NamedQuery(name = "Result.findAll", query = "SELECT r FROM Result r"),
    @NamedQuery(name = "Result.findByIdRezult", query = "SELECT r FROM Result r WHERE r.idRezult = :idRezult"),
    @NamedQuery(name = "Result.findByRes", query = "SELECT r FROM Result r WHERE r.res = :res")})
public class Result implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_REZULT", nullable = false)
    private Integer idRezult;
    @Column(name = "RES", length = 10)
    private String res;
    @JoinColumn(name = "ID_UNIT", referencedColumnName = "ID_UNIT")
    @ManyToOne
    private DicUnit dicUnit;
    @JoinColumn(name = "ID_P", referencedColumnName = "ID_P")
    @ManyToOne
    private Pokazatel pokazatel;
    @JoinColumn(name = "ID_TIME", referencedColumnName = "ID_TIME")
    @ManyToOne
    private DicTime dicTime;
    @JoinColumn(name = "ID_SELSOV", referencedColumnName = "ID_SELSOV")
    @ManyToOne
    private Selsovet selsovet;
    @JoinColumn(name = "ID_RAJON_O", referencedColumnName = "ID_RAJON_O")
    @ManyToOne
    private RajonOld rajonOld;
    @JoinColumn(name = "ID_SUBJECT", referencedColumnName = "ID")
    @ManyToOne
    private SubjectRf subjectRf;
    @JoinColumn(name = "ID_POSELEN", referencedColumnName = "ID_POSELEN")
    @ManyToOne
    private GSPos gSPos;
    @JoinColumn(name = "ID_RAJON", referencedColumnName = "ID_RAJON")
    @ManyToOne
    private Rajon rajon;
    @JoinColumn(name = "ID_IST", referencedColumnName = "ID_IST")
    @ManyToOne
    private DicIst dicIst;
    @JoinColumn(name = "ID_GEOOBJE", referencedColumnName = "ID_NP")
    @ManyToOne
    private Geoobject geoobject;

    public Result() {
    }

    public Result(Integer idRezult) {
        this.idRezult = idRezult;
    }

    public Integer getIdRezult() {
        return idRezult;
    }

    public void setIdRezult(Integer idRezult) {
        Integer oldIdRezult = this.idRezult;
        this.idRezult = idRezult;
        changeSupport.firePropertyChange("idRezult", oldIdRezult, idRezult);
    }

    public String getRes() {
        return res;
    }

    public void setRes(String res) {
        String oldRes = this.res;
        this.res = res;
        changeSupport.firePropertyChange("res", oldRes, res);
    }

    public DicUnit getDicUnit() {
        return dicUnit;
    }

    public void setDicUnit(DicUnit dicUnit) {
        DicUnit oldDicUnit = this.dicUnit;
        this.dicUnit = dicUnit;
        changeSupport.firePropertyChange("dicUnit", oldDicUnit, dicUnit);
    }

    public Pokazatel getPokazatel() {
        return pokazatel;
    }

    public void setPokazatel(Pokazatel pokazatel) {
        Pokazatel oldPokazatel = this.pokazatel;
        this.pokazatel = pokazatel;
        changeSupport.firePropertyChange("pokazatel", oldPokazatel, pokazatel);
    }

    public DicTime getDicTime() {
        return dicTime;
    }

    public void setDicTime(DicTime dicTime) {
        DicTime oldDicTime = this.dicTime;
        this.dicTime = dicTime;
        changeSupport.firePropertyChange("dicTime", oldDicTime, dicTime);
    }

    public Selsovet getSelsovet() {
        return selsovet;
    }

    public void setSelsovet(Selsovet selsovet) {
        Selsovet oldSelsovet = this.selsovet;
        this.selsovet = selsovet;
        changeSupport.firePropertyChange("selsovet", oldSelsovet, selsovet);
    }

    public RajonOld getRajonOld() {
        return rajonOld;
    }

    public void setRajonOld(RajonOld rajonOld) {
        RajonOld oldRajonOld = this.rajonOld;
        this.rajonOld = rajonOld;
        changeSupport.firePropertyChange("rajonOld", oldRajonOld, rajonOld);
    }

    public SubjectRf getSubjectRf() {
        return subjectRf;
    }

    public void setSubjectRf(SubjectRf subjectRf) {
        SubjectRf oldSubjectRf = this.subjectRf;
        this.subjectRf = subjectRf;
        changeSupport.firePropertyChange("subjectRf", oldSubjectRf, subjectRf);
    }

    public GSPos getGSPos() {
        return gSPos;
    }

    public void setGSPos(GSPos gSPos) {
        GSPos oldGSPos = this.gSPos;
        this.gSPos = gSPos;
        changeSupport.firePropertyChange("GSPos", oldGSPos, gSPos);
    }

    public Rajon getRajon() {
        return rajon;
    }

    public void setRajon(Rajon rajon) {
        Rajon oldRajon = this.rajon;
        this.rajon = rajon;
        changeSupport.firePropertyChange("rajon", oldRajon, rajon);
    }

    public DicIst getDicIst() {
        return dicIst;
    }

    public void setDicIst(DicIst dicIst) {
        DicIst oldDicIst = this.dicIst;
        this.dicIst = dicIst;
        changeSupport.firePropertyChange("dicIst", oldDicIst, dicIst);
    }

    public Geoobject getGeoobject() {
        return geoobject;
    }

    public void setGeoobject(Geoobject geoobject) {
        Geoobject oldGeoobject = this.geoobject;
        this.geoobject = geoobject;
        changeSupport.firePropertyChange("geoobject", oldGeoobject, geoobject);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRezult != null ? idRezult.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Result)) {
            return false;
        }
        Result other = (Result) object;
        if ((this.idRezult == null && other.idRezult != null) || (this.idRezult != null && !this.idRezult.equals(other.idRezult))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.Result[idRezult=" + idRezult + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
}
